import com.spark.Service.AccountService;
import com.spark.Service.UserService;
import com.spark.pojo.Account;
import com.spark.pojo.User;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.Date;
import java.util.List;
import java.util.UUID;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:application*.xml"})
public class test {

    @Autowired
    AccountService accountService;

    @Autowired
    UserService userService;

    @Test
    public void testMybatisSpring() throws Exception {
        List<Account> accounts = accountService.queryAccountList();
        for (int i = 0; i < accounts.size(); i++) {
            System.out.println(accounts.get(i));
        }

    }

    @Test
    public void testAddUser(){
        int i = userService.addUser(new User(UUID.randomUUID().toString(),"world","123456",1,new Date(),"wtf","null",
                "123456@qq.com"));
        System.out.println(i);
    }
    @Test
    public void testGetUserCount(){
        System.out.println(userService.getUserCount());
    }
}
